<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:th="http://www.thymeleaf.org"
      xmlns:tiles="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org"
      lang="en">

<head>

    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    <!-- This <head> section is only used for static prototyping purposes. At runtime, -->
    <!-- Tiles will only use the body fragment defined with tiles:fragment="content",  --> 
    <!-- as specified at the corresponding views.xml file.                             -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

    <title>Spring Travel: Spring MVC and Web Flow Reference Application</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    
    <link rel="stylesheet" type="text/css" media="screen, projection" 
          href="../../styles/blueprint/screen.css" />
    
    <link rel="stylesheet" type="text/css" media="print" 
          href="../../styles/blueprint/print.css" />
    
    <!--[if lt IE 8]>
        <link rel="stylesheet" type="text/css" media="screen, projection"
              href="../../styles/blueprint/ie.css" />
    <![endif]-->
    
    <link rel="stylesheet" type="text/css" media="screen" 
          href="../../styles/booking.css" />

    
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
    <!-- Some styles and scripts are served from spring-js-resources-{ver}.jar at -->
    <!-- runtime. Therefore not available for static prototyping. See the         -->
    <!-- layouts/standard.html template file for detail.                          -->
    <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
    
</head>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- START of the content to be included in the execution result.  -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Only the markup inside this <body> would be required in this  -->
<!-- template if no static prototyping was intended.               -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<body tiles:fragment="content">



<h1>Hotel Results</h1>

<p>
    <a id="changeSearchLink" href="#" 
       th:href="@{hotels/search(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize})}">Change Search</a>
    <script type="text/javascript">
        // <![CDATA[
        Spring.addDecoration(new Spring.AjaxEventDecoration({
            elementId: "changeSearchLink",
            event: "onclick",
            popup: true,
            params: {fragments: "searchForm"}       
        }));
        // ]]>
    </script>
</p>

<div id="hotelResults">

  <div th:if="${hotelList}">
  
    <table class="summary">
        <thead>
            <tr>
                <th>Name</th>
                <th>Address</th>
                <th>City, State</th>
                <th>Zip</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <tr th:each="hotel : ${hotelList}">
                <td th:text="${hotel.name}">The Herb Plaza</td>
                <td th:text="${hotel.address}">Thyme Square, 13</td>
                <td th:text="${hotel.city} + ', ' + ${hotel.state} + ', ' + ${hotel.country}">Icetown, North Pole, Earth</td>
                <td th:text="${hotel.zip}">0W</td>
                <td><a href="#" th:href="@{'hotels/' + ${hotel.id}}">View Hotel</a></td>
            </tr>
            <tr th:unless="${hotelList}">
                <td colspan="5">No hotels found</td>
            </tr>
        </tbody>
    </table>
    
    <div class="buttonGroup">
        <div class="span-3">
            <div th:if="${searchCriteria.page > 0}">
                <a id="prevResultsLink" href="#" 
                   th:href="@{hotels(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize},page=${searchCriteria.page - 1})}">Previous Results</a>
                <script type="text/javascript">
                    // <![CDATA[
                    Spring.addDecoration(new Spring.AjaxEventDecoration({
                        elementId: "prevResultsLink",
                        event: "onclick",
                        params: {fragments: "body"}
                    }));
                    // ]]>
                </script>
            </div>
        </div>
        <div class="span-3 append-12 last">
            <div th:if="${hotelList} and ${hotelList.size() == searchCriteria.pageSize}">
                <a id="moreResultsLink" href="#" 
                   th:href="@{hotels(searchString=${searchCriteria.searchString},pageSize=${searchCriteria.pageSize},page=${searchCriteria.page + 1})}">More Results</a>
                <script type="text/javascript">
                    // <![CDATA[
                    Spring.addDecoration(new Spring.AjaxEventDecoration({
                        elementId: "moreResultsLink",
                        event: "onclick",
                        params: {fragments: "body"}     
                    }));
                    // ]]>
                </script>
            </div>      
        </div>
    </div>
  </div>

</div>  


</body>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- END of the content to be included in the execution result -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

</html>
